import http from "@/api";

import { PORT1 } from "@/api/config/servicePort";

// 路由枚举
export const enum RouteType {
    sale = "sale", //消费品
    mro = "mro", //工业品
    food = "foodGoods" //食品
  }


const typeObj={
  sale:'custom_tariff',
  mro:'industry_tariff',
  foodGoods:'foods_tariff'
}
  
//海关税则树状图
export const getTariffTreeApi = (data: Record<string, any>) =>
    http.get(`${PORT1}/goods-config/tariff/tariff/type-tree`, { ...data }, { loading: false });
    
//列表头部
export const getTariffHeadApi = (params: FormData) =>  
    http.get(PORT1+`/goods-config/tariff/tariff/field`, params, { cancel: false });
 
//列表
export const getTariffListApi = (params: FormData) =>  
    http.post(PORT1+`/goods-config/tariff/tariff/list`, params, { cancel: false });


//获取高级搜索
export const getTariffSearchItemApi = (params: FormData,type:string) =>  
  http.get(PORT1+`/goods-config/tariff/tariff/search-item?get_auth=1&auth_name=${typeObj[type]}`, params, { cancel: false });

    
//获取表单
export const getTariffFormApi = (params: FormData) =>  
  http.get(PORT1+`/goods-config/tariff/tariff/form`, params, { cancel: false });

 //保存
 export const getTariffSaveApi = (params: FormData) => 
  http.post(PORT1+`/goods-config/tariff/tariff/save`, params, { cancel: false });


 //删除 
  export const getTariffDelApi = (params: FormData) => 
    http.post(PORT1+`/goods-config/tariff/tariff/delete`, params, { cancel: false });



  //下载导入模板
export const downTempleteApi = (params: FormData) =>  
  http.download(PORT1+`/goods-config/tariff/tariff-import/excel`, params, { cancel: false });

  //下载失败文件
  export const downFailTempleteApi = (params: FormData) =>  
    http.download(PORT1+`/goods-config/tariff/tariff-import/download-import`, params, { cancel: false });
  


// 枚举路径
export const enum Path {
  tariffUpload = "/goods-config/tariff/tariff-import/upload",//上传文件
  
}



// 

 export const getTariffBathEditApi = (params: FormData) => 
  http.post(PORT1+`/goods-config/tariff/tariff/batch-edit-data`, params, { cancel: false });

 export const getTariffBathSaveApi = (params: FormData) => 
  http.post(PORT1+`/goods-config/tariff/tariff/batch-save`, params, { cancel: false });

 export const getTariffBathDelApi = (params: FormData) => 
  http.post(PORT1+`/goods-config/tariff/tariff/batch-delete`, params, { cancel: false });


